package com.dfbz.demo02_静态代理解决问题;

/**
 * @author lscl
 * @version 1.0
 * @intro: 代理对象
 */
public class UserServiceProxy implements UserService {

    private UserService userService;

    public UserServiceProxy(UserService userService) {
        this.userService = userService;
    }

    @Override
    public void add() {
        System.out.println("日志....");
        userService.add();
        System.out.println("日志....");
    }

    @Override
    public void delete(Integer id) {
        System.out.println("删除日志....");
        userService.delete(id + 100);
        System.out.println("删除日志....");
    }

    @Override
    public void update(Integer id) {
        System.out.println("更新日志....");
        userService.update(id + 100);
        System.out.println("更新日志....");
    }

    @Override
    public String query() {
        System.out.println("查询日志....");
        String res = userService.query();

        return res + "【query】";
    }

    @Override
    public void flush() {
        userService.flush();
    }
}
